import 'package:dio/dio.dart';

import 'package:flutter_oldman_health/http/base_dio.dart';
import 'package:flutter_oldman_health/models/response_data_model.dart';
import 'package:flutter_oldman_health/models/login_model.dart';
import 'package:flutter_oldman_health/models/register_model.dart';
import 'package:retrofit/retrofit.dart';

part 'api_client.g.dart';

@RestApi(baseUrl: 'http://test.qsyservice.cn:31246')
abstract class ApiClient {
  factory ApiClient({Dio dio, String baseUrl}) {
    dio ??= BaseDio.getInstance().getDio();
    return _ApiClient(dio, baseUrl: baseUrl);
  }

  // 登录
  @POST('/manager/v3/user/login')
  Future<LoginModel> login(@Body() Login login);

  // 注册
  @POST('/manager/medical/user/{enterpriseId}/register')
  Future<ResponseDataModel<String>> register(
      @Path('enterpriseId') String enterpriseId, @Body() Register register);

  /// 获取验证码
  @GET('/manager/medical/user/verification_code/{phone}')
  Future<ResponseDataModel<String>> requestVerificationCode(
      @Path('phone') String phone);

//   @GET('/users/{userId}')
//   Future<UserModel> getUserInfo(@Path('userId') int userId);
}
